package cn.buk.tms.eotms.dto;

import cn.buk.tms.eotms.entity.AttractionInfo;
import cn.buk.tms.eotms.entity.AttractionPicture;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.Set;

public class AttractionInfoDto {

  private int id;

  private int enterpriseId;

  /**
   * 景点名称
   */
  @NotNull
  @Size(min = 5)
  private String name;

  /**
   * 景区A级
   */
  private int star;

  /**
   * 地址
   */
  private String address;

  /**
   * 开放时间
   */
  private String openTime;

  /**
   * 景点简介
   */
  private String shortIntro;

  /**
   * 景点详细介绍
   */
  private String longIntro;

  /**
   * 预订须知
   */
  private String notice;

  private String remark;

  /**
   * 是否启用
   * 1-启用
   * 0-不启用
   * 4-永不启用
   */
  private int status;

  /**
   * 图片
   */
  private Set<AttractionPicture> pictures;

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date createTime;

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date lastUpdate;

  public static AttractionInfoDto createdBy(AttractionInfo info) {
    AttractionInfoDto dto = new AttractionInfoDto();

    BeanUtils.copyProperties(info, dto);

    return dto;
  }

  public static AttractionInfo convertedBy(AttractionInfoDto dto) {
    AttractionInfo info = new AttractionInfo();
    BeanUtils.copyProperties(dto, info);
    return info;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public int getEnterpriseId() {
    return enterpriseId;
  }

  public void setEnterpriseId(int enterpriseId) {
    this.enterpriseId = enterpriseId;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getStar() {
    return star;
  }

  public void setStar(int star) {
    this.star = star;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getOpenTime() {
    return openTime;
  }

  public void setOpenTime(String openTime) {
    this.openTime = openTime;
  }

  public String getShortIntro() {
    return shortIntro;
  }

  public void setShortIntro(String shortIntro) {
    this.shortIntro = shortIntro;
  }

  public String getLongIntro() {
    return longIntro;
  }

  public void setLongIntro(String longIntro) {
    this.longIntro = longIntro;
  }

  public String getNotice() {
    return notice;
  }

  public void setNotice(String notice) {
    this.notice = notice;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

  public Set<AttractionPicture> getPictures() {
    return pictures;
  }

  public void setPictures(Set<AttractionPicture> pictures) {
    this.pictures = pictures;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getLastUpdate() {
    return lastUpdate;
  }

  public void setLastUpdate(Date lastUpdate) {
    this.lastUpdate = lastUpdate;
  }
}
